#define _CRT_SECURE_NO_WARNINGS 1


#include<map>
#include<vector>
#include<iostream>

using namespace std;

int main()
{
	int n = 0;
	cin >> n;
	vector<int> v(n);
	map<int, int> hash;
	for (int i = 0; i < n; i++)
	{
		cin >> v[i];
		hash[v[i]]++;
	}
	for (auto& e : hash)
	{
		cout << e.first << ' ' << e.second << endl;
	}

	return 0;
}